package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProLd5;
import com.huizu.project.service.IProLd5Service;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 大学生创新创业Controller
 * 
 * @author zhangmx
 * @date 2024-05-10
 */
@RestController
@RequestMapping("/project/prold5")
public class ProLd5Controller extends BaseController
{
    @Autowired
    private IProLd5Service proLd5Service;

    /**
     * 查询大学生创新创业列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold5:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProLd5 proLd5)
    {
        startPage();
        List<ProLd5> list = proLd5Service.selectProLd5List(proLd5);
        return getDataTable(list);
    }

    /**
     * 导出大学生创新创业列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold5:export')")
    @Log(title = "大学生创新创业", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProLd5 proLd5)
    {
        List<ProLd5> list = proLd5Service.selectProLd5List(proLd5);
        ExcelUtil<ProLd5> util = new ExcelUtil<ProLd5>(ProLd5.class);
        util.exportExcel(response, list, "大学生创新创业数据");
    }

    /**
     * 获取大学生创新创业详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:prold5:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proLd5Service.selectProLd5ById(id));
    }

    /**
     * 新增大学生创新创业
     */
    @PreAuthorize("@ss.hasPermi('project:prold5:add')")
    @Log(title = "大学生创新创业", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProLd5 proLd5)
    {
        return toAjax(proLd5Service.insertProLd5(proLd5));
    }

    /**
     * 修改大学生创新创业
     */
    @PreAuthorize("@ss.hasPermi('project:prold5:edit')")
    @Log(title = "大学生创新创业", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProLd5 proLd5)
    {
        return toAjax(proLd5Service.updateProLd5(proLd5));
    }

    /**
     * 删除大学生创新创业
     */
    @PreAuthorize("@ss.hasPermi('project:prold5:remove')")
    @Log(title = "大学生创新创业", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proLd5Service.deleteProLd5ByIds(ids));
    }
}
